<?php
session_start();
include('../includes/index.php');
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
	$sql = "SELECT titel, kolom_id FROM `kolom` WHERE `kolom_id` = " . $_POST['kolom'] . ";";
	$query = mysql_query ($sql);
	$output = mysql_fetch_assoc ($query);
	$sql2 = "DELETE FROM `kolom` WHERE `kolom_id` = " . $kolom . ";";
	mysql_query($sql2);
	echo 'De kolom ' . $output['titel'] . ' is met succes verwijderd.';
}
else
{
?>
	<div style="margin-left: 40px;"><form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
	Welke kolom:<br />
	<?php
	$query = mysql_query ("SELECT kolom_id, titel FROM kolom WHERE active = 1;");
	echo '<select name="kolom">';
	while ($result = mysql_fetch_assoc ($query))
	{
		echo '<option value="' . $result['kolom_id'] . '">' . $result['titel'] . '</option>' . "\n";
	}
	echo '</select>';
	?>
	<br /><br />
	<input type="submit" value="Verwijder kolom">&nbsp;&nbsp;<input type="reset" value="Leeg formulier"></form></div>
<?php
}
//print_r ($_SESSION);
?>